class Node():
	"""docstring for Node"""
	
	value = None
	nextNode = None
	previousNode = None
	
	def __init__(self, value):
		self.value = value

class LinkedList():
	"""docstring for LinkedList"""
	
	headNode = Node
	tailNode = Node
	currentNode = Node
	
	def Add(self, value):
		node = Node(value)
		
		# Check for head's nextNode being None.
		if self.headNode.nextNode == None:
			node.previousNode = self.headNode
			node.nextNode = self.tailNode
			
			self.headNode.nextNode = node
			self.tailNode.previousNode = node
		else:
			node.previousNode = self.tailNode.previousNode
			node.nextNode = self.tailNode
			
			self.tailNode.previousNode.nextNode = node
			self.tailNode.previousNode = node
			
	def Search(self, value):
		n = self.headNode
		
		while n.nextNode.value != None:
			n = n.nextNode
			
			if n.value == value:
				return n
		
		return None
			
	def Print(self):
		n = self.headNode
		
		while n.nextNode.value != None:
			n = n.nextNode
			print n.value
		
if __name__ == "__main__":
	ll = LinkedList()
	ll.Add("hello")
	ll.Add("world")
	ll.Add("oh snap")
	ll.Print()
	
	searchPhrase = "world"
	n = ll.Search(searchPhrase)
	
	if n != None:
		print n.value
	else:
		print "Couldn't find ", searchPhrase